<?php

/**
 * Form SEO
 * @copyright 2010
 * @version $Id$
 * @access public
 */
class Admin_Form_Seo extends Zend_Form
{
	
    public function __construct($data='') {

        parent::__construct($data);

        $translate = Zend_Registry::get('Zend_Translate');
        $id=new Zend_Form_Element_Hidden('Id');

        $title=new Zend_Form_Element_Text('Title');
        $title->setAttribs(array('size' => '40'));
        $title->setLabel($translate->_('Site Title').':');
        $title->setRequired();

        $subject=new Zend_Form_Element_Text('Subject');
        $subject->setLabel($translate->_('Subject').':');
        $subject->setAttribs(array('size' => '40'));
        $subject->setRequired();

        $city=new Zend_Form_Element_Text('City');
        $city->setLabel($translate->_('City').':');
        $city->setAttribs(array('size' => '40'));

        $country=new Zend_Form_Element_Text('Country');
        $country->setLabel($translate->_('Country').':');
        $country->setAttribs(array('size' => '40'));

        $keywords= new Zend_Form_Element_Textarea('Keywords');
        $keywords->setLabel($translate->_('Keywords'));
        $keywords->setAttribs(array('cols' => '40', 'rows' => '7'));

        $description= new Zend_Form_Element_Textarea('Description');
        $description->setLabel($translate->_('Site description').':');
        $description->setAttribs(array('cols' => '40', 'rows' => '7'));

	$robots=new Zend_Form_Element_Select('Robots');
        $robots->setLabel($translate->_('Robots').':');
        
        $revisit=new Zend_Form_Element_Select('Revisit');
        $revisit->setLabel($translate->_('Revisit').':');

        $language=new Zend_Form_Element_Select('Language');
        $language->setLabel($translate->_('Language').':');

        $distribution=new Zend_Form_Element_Select('Distribution');
        $distribution->setLabel($translate->_('Distribution').':');

        $Submit=new Zend_Form_Element_Submit('Submit');

        if(isset($data['Description']))
                $description->setValue($data['Description']);
        if(isset($data['Keywords']))
                $keywords->setValue($data['Keywords']);
        if(isset($data['Distribution']))
                $distribution->setValue($data['Distribution']);
        if(isset($data['Subject']))
                $subject->setValue($data['Subject']);
        if(isset($data['Title']))
                $title->setValue($data['Title']);
        if(isset($data['Country']))
                $country->setValue($data['Country']);
        if(isset($data['City']))
                $city->setValue(($data['City']));
        if(isset($data['Id']))
                $id->setValue($data['Id']);

        $language
            ->setMultiOptions
            (
                array(
                    'English' => 'English',
                    'Spanish' => 'Spanish'
                )
            );

        $robots
            ->addMultiOptions
            (
                array(
                    'All'       => 'All',
                    'None'      => 'None',
                    'Index'     => 'Index',
                    'No Index'  => 'No Index',
                    'Follow'    => 'Follow',
                    'No Follow' => 'No Follow'
                )
            );

        $distribution
            ->addMultiOptions
            (
                array(
                    'Global'=> 'Global',
                    'Local' => 'Local'
                )
            );

        $revisit
            ->addMultiOptions
            (
                array(
                    '1 day'  => '1 dia',
                    '2 days' => '2 dias',
                    '3 days' => '3 dias',
                    '4 days' => '4 dias',
                    '5 days' => '5 dias',
                    '7 days' => '7 dias',
                    '15 days'=> '15 dias',
                    '30 days'=> '30 dias'
                )
            );

        $revisit->setValue((isset($data['Revisit'])) ? $data['Revisit'] : '1 day') ;

        $distribution->setValue((isset($data['Distribution']))? $data['Distribution'] : 'Global');
        
        $robots->setValue((isset($data['Robots'])) ? $data['Robots'] : 'All');

        $language->setValue((isset($data['Language'])) ? $data['Language'] : 'Spanish');


        $this->addElement($id);
        $this->addElement($title);
        $this->addElement($subject);
        $this->addElement($city);
        $this->addElement($country);
        $this->addElement($description);
        $this->addElement($distribution);
        $this->addElement($keywords);
        $this->addElement($robots);
        $this->addElement($revisit);
        $this->addElement($language);
        $this->addElement($Submit);
    }
}